package com.stars.services.impl.mygenerate;
import com.github.pagehelper.PageInfo;
import com.stars.entity.mygenerate.CgGroupEntity;
import com.stars.services.mygenerate.CgGroupAccessServices;
import com.stars.dao.mapper.mygenerate.CgGroupMapper;
import com.stars.entity.dto.mygenerate.CgGroupDTO;

import java.util.List;
import com.stars.entity.ListPage;
import com.github.pagehelper.PageHelper;
import com.stars.services.impl.BaseAccessServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Title: 模板分组 业务逻辑
 * @author dj
 * @date 2019-10-28 14:08:44
 * @version V1.0
 *
 */
@Service
public class CgGroupAccessServicesImpl  extends BaseAccessServiceImpl<CgGroupMapper , CgGroupEntity> implements  CgGroupAccessServices {
    @Autowired
    private CgGroupMapper  cgGroupMapper;


    /**
     * 分页查询
     * @param pageNum 查询参数 起始页，大小。
     * @return
     */
    @Override
    public PageInfo<CgGroupDTO> pageList(Integer pageNum, Integer pageSize, CgGroupDTO dto) throws Exception{
        ListPage<CgGroupDTO> listPage = new ListPage<>(pageNum, pageSize, dto);
        PageHelper.startPage(pageNum, pageSize);
        List<CgGroupDTO> list = cgGroupMapper.pageQueryCgGroup(listPage);
        PageInfo<CgGroupDTO> pageInfo = new PageInfo<>(list);
        return pageInfo;
    }
}
